<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
  <head>
    <title>jQuery WeUI</title>
    <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

<link rel="stylesheet" href="/project3/movie/movie/Public/html/jquery-weui/lib/weui.min.css">
<link rel="stylesheet" href="/project3/movie/movie/Public/html/jquery-weui/css/jquery-weui.css">
<link rel="stylesheet" href="/project3/movie/movie/Public/html/jquery-weui/demos.css">
<link href="/project3/movie/movie/Public/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
 <link href="/project3/movie/movie/Public/static/art-dialog/css/ui-dialog.css" rel="stylesheet"/>
 <link href="/project3/movie/movie/Public/static/pfinal/css/base.css" rel="stylesheet"/>

  </head>

  <body ontouchstart>


    <header class='demos-header'>
      <h1 class="demos-title">评论</h1>
    </header>

     <div class='demos-content-padded'>
      <div class="weui_progress">
        <div class="weui_progress_bar">
          <div class="weui_progress_inner_bar js_progress" style="width: 80%;"></div>
        </div>
      </div>
      <br/>
     <center>评分:
      <img src="/project3/movie/movie/Public/img/ncomment.png" width="30px" id="pf1" onclick="test(this)">
      <img src="/project3/movie/movie/Public/img/ncomment.png" width="30px" id="pf2" onclick="test(this)">
      <img src="/project3/movie/movie/Public/img/ncomment.png" width="30px" id="pf3" onclick="test(this)">
      <img src="/project3/movie/movie/Public/img/ncomment.png" width="30px" id="pf4" onclick="test(this)">
      <img src="/project3/movie/movie/Public/img/ncomment.png" width="30px" id="pf5" onclick="test(this)">
      <span id='xz' style="color:red;display:none">请选择评分</span>
      </center> 
      <br/>
      <center><textarea style="width:80%;height:140px" id="text" focus="fcu()"></textarea></center>
      <br/>
       <div class="btn btn-primary js-cute" style="margin-left:75%;" onclick="func()">提交</div>
    </div>
    <script src="/project3/movie/movie/Public/html/jquery-weui/lib/jquery-2.1.4.js"></script>
    <script src="/project3/movie/movie/Public/html/jquery-weui/jquery-weui.js"></script>
    <script src="/project3/movie/movie/Public/static/jquery/jquery.min.js"></script>
    <script src="/project3/movie/movie/Public/static/bootstrap/js/bootstrap.min.js"></script>
    <script src="/project3/movie/movie/Public/static/art-dialog/dist/dialog-min.js"></script>
    <script src="/project3/movie/movie/Public/static/pfinal/pfinal.js"></script>
  </body>
  <script>
   
   function test(obj){
     var numb=$(obj).attr("id").substring(2,3);
     if($(obj).attr("src")=='/project3/movie/movie/Public/img/ncomment.png'){
      for (var i = 0; i <= numb; i++) {
        $("#pf"+i).attr("src","/project3/movie/movie/Public/img/ycomment.png");
       }
     }else{
      for (var i = numb; i <= 5; i++) {
        $("#pf"+i).attr("src","/project3/movie/movie/Public/img/ncomment.png");
       }
     }
   }

   function func(){
    var text=$('#text').val();
    var pf=$("img[src='/project3/movie/movie/Public/img/ycomment.png']").length;
    if (text=='') {
      $('#text').val('请输入内容!!!').css('color','red');return
    }else if (pf==0) {
      $('#xz').css('display','');return;
    }
    var oid=<?php echo ($oid); ?>;
    var mid=<?php echo ($mid); ?>;
    var movie_id=<?php echo ($movie_id); ?>;
     $.ajax({
           type:'post',
           url:"<?php echo U('comment/add');?>",
           data:{'text':text,'mark':pf,'order_id':oid,'mid':mid,'movie_id':movie_id},
           datatype:'json',
           success:function(data){
           box(data);
       }
    })
   }

   $("#text").focus(function(){
  if ($("#text").val()=='请输入内容!!!') {
    $("#text").val('').css('color','black');return;
    };
  });
      function box(list) {
        pFinal.toast(list, function () {
            window.location.href="<?php echo U('Member/order');?>"; 
        });
    };
  </script>
</html>